package com.javaEE.tes.dao;

import com.javaEE.tes.entities.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface UserAccountRepository extends CrudRepository<UserAccount,Long> {
    @Autowired
    List<UserAccount> findAll();
    UserAccount findByStudent_StudentId(Long studentId);
    @Query(nativeQuery = true,value = "SELECT u.userName as username FROM user_accounts AS u WHERE u.username = ? ")
    UserAccount findUserName(String UserName);
    @Query(nativeQuery = true,value = "SELECT u.password FROM user_accounts AS u WHERE u.password = ? ")
    String findByPassByUserName(String UserName);
}
